/**
 * 由 WangYu 创建
 * 日期 2017/10/18
 */
import React, {Component} from 'react';
import {
    StyleSheet,
    Text,
    View,
    Image,
    TouchableOpacity,
} from 'react-native';
import NetUtils from "../../util/NetUtils";
import Api from "../../util/Api";
export default class AboutUsPage extends Component {

    constructor(props) {
        super(props);
        this.state={
            object:{},
            val:0,
        }
    }

    render() {
        console.log('wangyu','触发render:'+this.state.val);
        return (
            <View style={styles.container}>
                <Image style={{width:60,height:60,marginTop:20,alignSelf:'center'}} source={require('../../../images/icon.png')}/>
                <Text style={{padding:15}}>{this.state.object.jieshao}</Text>
                <View style={{backgroundColor:'white'}}>

                </View>
            </View>
        );
    }

    componentDidMount() {
        this.getData();
        this.setState((preState,props)=>{val:preState.val+1});
        console.log('wangyu',this.state.val);
        this.setState({val:this.state.val+1});
        console.log('wangyu',this.state.val);
         setTimeout(()=>{
             console.log('wangyu','timeout:'+this.state.val);
             this.setState({val:this.state.val+1});
             console.log('wangyu','timeout:'+this.state.val);
             this.setState({val:this.state.val+1});
             console.log('wangyu','timeout:'+this.state.val);
             this.setState({val:this.state.val+1});
             console.log('wangyu','timeout:'+this.state.val);
             this.setState({val:this.state.val+1});
             console.log('wangyu','timeout:'+this.state.val);
         },0)
    }

    getData(){
        NetUtils.get(Api.about,null,result=>{
            if(result.code===1){
                this.setState({object:result.object});
            }
        })
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor:'#dadada'
    },
});
